<template>
	<view>
		<!-- 基础表单校验 -->
		<uni-forms ref="valiForm" :rules="rules" :model="valiFormData" labelWidth="80px">
			<uni-section title="师德师风" type="line">
				<view class="example" style="padding: 10px;">
					<view class="uni-title">为人师表,教书育人,关爱学生</view>
					<uni-forms-item name="sdsf1">
						<slider name="sdsf1" value="1" min="1" max="3" v-model="valiFormData.sdsf1"
							@change="sliderChange1" show-value></slider>
					</uni-forms-item>
					<view class="uni-title">教态自然大方,衣着得体</view>
					<uni-forms-item name="sdsf2">
						<slider value="1" min="1" max="3" v-model="valiFormData.sdsf2" @change="sliderChange2"
							show-value></slider>
					</uni-forms-item>
					<view class="uni-title">上课精神饱满,语言流畅,用普通话教学</view>
					<uni-forms-item name="sdsf3">
						<slider value="1" min="1" max="3" v-model="valiFormData.sdsf3" @change="sliderChange3"
							show-value></slider>
					</uni-forms-item>
					<view class="uni-title">按时上下课,不无故缺课</view>
					<uni-forms-item name="sdsf4">
						<slider value="1" min="1" max="3" v-model="valiFormData.sdsf4" @change="sliderChange4"
							show-value></slider>
					</uni-forms-item>
					<view class="uni-title">管教管导,严格要求学生</view>
					<uni-forms-item name="sdsf5">
						<slider value="1" min="1" max="3" v-model="valiFormData.sdsf5" @change="sliderChange5"
							show-value></slider>
					</uni-forms-item>
					<view class="uni-title">及时布置与讲解作业,培养学生自然学习的兴趣与习惯</view>
					<uni-forms-item name="sdsf6">
						<slider value="1" min="1" max="3" v-model="valiFormData.sdsf6" @change="sliderChange6"
							show-value></slider>
					</uni-forms-item>
				</view>
			</uni-section>
			<uni-section title="教学内容" type="line">
				<view class="example" style="padding: 10px;">
					<view class="uni-title">有效驾驭教材内容，及时补充课程的新知识，新技能</view>
					<uni-forms-item name="jxnr1">
						<slider name="jxnr1" value="1" min="1" max="8" v-model="valiFormData.jxnr1"
							@change="sliderChangejxnr1" show-value></slider>
					</uni-forms-item>
					<view class="uni-title">教态自然大方,衣着得体</view>
					<uni-forms-item name="jxnr2">
						<slider value="1" min="1" max="8" v-model="valiFormData.jxnr2" @change="sliderChangejxnr2"
							show-value></slider>
					</uni-forms-item>
					<view class="uni-title">上课精神饱满,语言流畅,用普通话教学</view>
					<uni-forms-item name="jxnr3">
						<slider value="1" min="1" max="8" v-model="valiFormData.jxnr3" @change="sliderChangejxnr3"
							show-value></slider>
					</uni-forms-item>
					<view class="uni-title">按时上下课,不无故缺课</view>
					<uni-forms-item name="jxnr4">
						<slider value="1" min="1" max="8" v-model="valiFormData.jxnr4" @change="sliderChangejxnr4"
							show-value></slider>
					</uni-forms-item>
				</view>
			</uni-section>
			<uni-section title="教学方法" type="line">
				<view class="example" style="padding: 10px;">
					<view class="uni-title">运用启发式教学，注重培养学生的自学能力</view>
					<uni-forms-item name="jxff1">
						<slider value="1" min="1" max="3" v-model="valiFormData.jxff1" @change="sliderChangejxff1"
							show-value></slider>
					</uni-forms-item>
					<view class="uni-title">将多媒体与板书有机结合，运用信息平台知道学生自学</view>
					<uni-forms-item name="jxff2">
						<slider value="1" min="1" max="3" v-model="valiFormData.jxff2" @change="sliderChangejxff2"
							show-value></slider>
					</uni-forms-item>
					<view class="uni-title">板书设计科学科研，合理，具有较强的逻辑性</view>
					<uni-forms-item name="jxff3">
						<slider value="1" min="1" max="3" v-model="valiFormData.jxff3" @change="sliderChangejxff3"
							show-value></slider>
					</uni-forms-item>
					<view class="uni-title">运用，“教学做合”一的教学模式，发挥学生的主体作用</view>
					<uni-forms-item name="jxff4">
						<slider value="1" min="1" max="3" v-model="valiFormData.jxff4" @change="sliderChangejxff4"
							show-value></slider>
					</uni-forms-item>
				</view>
			</uni-section>
			<uni-section title="教学效果" type="line">
				<view class="example" style="padding: 10px;">
					<view class="uni-title">使学生有明确的专业学习目标，调动其学习的主动性</view>
					<uni-forms-item name="jxxg1">
						<slider value="1" min="1" max="11" v-model="valiFormData.jxxg1" @change="sliderChangejxxg1"
							show-value></slider>
					</uni-forms-item>
					<view class="uni-title">学生到课率，听课率高，掌握教学内容</view>
					<uni-forms-item name="jxxg2">
						<slider value="1" min="1" max="12" v-model="valiFormData.jxxg2" @change="sliderChangejxxg2"
							show-value></slider>
					</uni-forms-item>
					<view class="uni-title">学生较好的掌握应有的知识和技能，提高自学能力</view>
					<uni-forms-item name="jxxg3">
						<slider value="1" min="1" max="15" v-model="valiFormData.jxxg3" @change="sliderChangejxxg3"
							show-value></slider>
					</uni-forms-item>
				</view>
			</uni-section>
			<uni-forms-item name="pyyjy">
				<uni-easyinput type="textarea" v-model="xssj.pyyjy" placeholder="评语与寄语" />
			</uni-forms-item>
			<button :loading="loading" :disabled="loading" type="primary" @click="submit('valiForm')">提交</button>
		</uni-forms>
		<page-head title="测评表单"></page-head>

	</view>
</template>
<script>
	var _this;
	var vk = uni.vk;
	import uniForms from "@/pages_modules/components/uni-forms/uni-forms";
	import uniFormsItem from "@/pages_modules/components/uni-forms-item/uni-forms-item";
	export default {
		components: {
			uniForms,
			uniFormsItem
		},
		data() {
			// 页面数据变量
			return {
				xssj: {
					pyyjy: ""
				},
				logininfo: false,
				qjhc: {
					ankz: false
				},
				syimg: 'https://mp-7c5f2fa7-1d2c-41f1-b3dd-1f45e490fd36.cdn.bspapp.com/cloudstorage/939374e2-cdad-4e6f-b088-9546464e94ea.jpg',
				loading: false,
				// 校验规则
				rules: {
					// zjhm: {
					// 	rules: [{
					// 		required: true,
					// 		errorMessage: '不能是空'
					// 	}]
					// }
				},
				valiFormData: {
					sdsf1: 1,
					sdsf2: 1,
					sdsf3: 1,
					sdsf4: 1,
					sdsf5: 1,
					sdsf6: 1,
					jxnr1: 1,
					jxnr2: 1,
					jxnr3: 1,
					jxnr4: 1,
					jxff1: 1,
					jxff2: 1,
					jxff3: 1,
					jxff4: 1,
					jxxg1: 1,
					jxxg2: 1,
					jxxg3: 1
				},
				isCard: false,
				// init请求返回的数据
				data: {

				},
				// 表单请求数据
				form1: {

				},
				scrollTop: 0,
			}
		},
		onPageScroll(e) {
			this.scrollTop = e.scrollTop;
		},
		// 监听 - 页面每次【加载时】执行(如：前进)
		async onLoad(options = {}) {
			vk = uni.vk;
			_this = this;
			this.options = options;
			const eventChannel = this.getOpenerEventChannel();
			if (eventChannel.on) {
				eventChannel.on('data', (data) => {
					_this.xssj = data
				});
			}
			//await this.getvkGlobalData()
		},
		// 监听 - 页面【首次渲染完成时】执行。注意如果渲染速度快，会在页面进入动画完成前触发
		onReady() {

		},
		// 监听 - 页面每次【显示时】执行(如：前进和返回) (页面每次出现在屏幕上都触发，包括从下级页面点返回露出当前页面)
		onShow() {

		},
		// 监听 - 页面每次【隐藏时】执行(如：返回)
		onHide() {

		},
		// 监听 - 点击右上角转发时
		onShareAppMessage(options) {

		},
		// 函数
		methods: {
			sliderChange1(e) {
				this.valiFormData.sdsf1 = e.detail.value
			},
			sliderChange2(e) {
				this.valiFormData.sdsf2 = e.detail.value
			},
			sliderChange3(e) {
				this.valiFormData.sdsf3 = e.detail.value
			},
			sliderChange4(e) {
				this.valiFormData.sdsf4 = e.detail.value
			},
			sliderChange5(e) {
				this.valiFormData.sdsf5 = e.detail.value
			},
			sliderChange6(e) {
				this.valiFormData.sdsf6 = e.detail.value
			},
			sliderChangejxnr1(e) {
				this.valiFormData.jxnr1 = e.detail.value
			},
			sliderChangejxnr2(e) {
				this.valiFormData.jxnr2 = e.detail.value
			},
			sliderChangejxnr3(e) {
				this.valiFormData.jxnr3 = e.detail.value
			},
			sliderChangejxnr4(e) {
				this.valiFormData.jxnr4 = e.detail.value
			},
			sliderChangejxff1(e) {
				this.valiFormData.jxff1 = e.detail.value
			},
			sliderChangejxff2(e) {
				this.valiFormData.jxff2 = e.detail.value
			},
			sliderChangejxff3(e) {
				this.valiFormData.jxff3 = e.detail.value
			},
			sliderChangejxff4(e) {
				this.valiFormData.jxff4 = e.detail.value
			},
			sliderChangejxxg1(e) {
				this.valiFormData.jxxg1 = e.detail.value
			},
			sliderChangejxxg2(e) {
				this.valiFormData.jxxg2 = e.detail.value
			},
			sliderChangejxxg3(e) {
				this.valiFormData.jxxg3 = e.detail.value
			},
			getvkGlobalData() {
				return vk.callFunction({
					url: 'client/gsxy/jwc/pub/jwcapi.getvkGlobalDataByid',
					title: '请求中...',
					data: {
						byid: '655ea65b21821b221963aea3'
					}
				}).then((data) => {
					_this.qjhc = data.info;
				}).catch((err) => {

				});
			},
			updateJslhpjb(sjjg) {
				return vk.callFunction({
					url: 'client/gsxy/jwc/kh/jwcapi.updateJslhpjb',
					title: '请求中...',
					data: {...sjjg}
				}).then((data) => {}).catch((err) => {});
			},
			submit(ref) {
				vk.pubfn.debounce(async () => {
					_this.loading = true
					this.$refs[ref].validate().then(async res => {
						let sum = 0;
						for (let key in _this.valiFormData) {
							if (typeof _this.valiFormData[key] === 'number') {
								sum += _this.valiFormData[key];
							}
						}
						_this.xssj.sum = sum
						//_this.xssj.sum = 100
						_this.xssj.sjtxzt = '1'
						if(_this.xssj.pyyjy){
							_this.xssj.pyzt = '1'
						}else{
							_this.xssj.pyzt = '0'
						}

						let sjjg = {
							..._this.xssj
						}
						await _this.updateJslhpjb(sjjg)
						_this.loading = false;
						vk.redirectTo('/pages_modules/jwc/gsxy-jw-xsgtdjstp?sfzh='+sjjg.zjhm)
					}).catch(err => {
						uni.showToast({
							title: err[0].errorMessage,
							icon: 'none'
						})
						_this.loading = false;
					})
				}, 1000);
			},
			IsCard(e) {
				this.isCard = e.detail.value
			}
		},
		// 监听器
		watch: {

		},
		// 计算属性
		computed: {

		}
	}
</script>
<style lang="scss" scoped>
	// .imageac{
	// 	width: 360px;
	// 	height: 166px;
	// }
</style>